<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>路径与子路径</title>
</head>
<body>
    <canvas id="canvas"></canvas>
</body>
<script>
    var canvas = document.getElementById('canvas'),
    context = canvas.getContext('2d');

    context.beginPath();

    context.rect(10,10,100,100);
    context.stroke();

    context.beginPath();

    context.rect(30,30,100,100);
    context.stroke();
</script>
</html>